package com.aerospace.dbmysql.modules.userInfo.controller;

import com.aerospace.dbmysql.modules.userInfo.entity.UserInfo;
import com.aerospace.dbmysql.modules.userInfo.service.UserInfoService;
import com.alibaba.fastjson.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class MybatisController {

    @Autowired
    private UserInfoService userInfoService;

    @GetMapping("/boot/user")
    public Object getUser(){
        List<UserInfo> userList =  userInfoService.findUserInfo();
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("userList", userList);
        return jsonObject.toString();
    }

    @GetMapping("/boot/update")
    public Object update(){
        return userInfoService.update();
    }
}
